#include "compile_run.hpp"

using namespace dsh_compile_and_run;

int main()
{
    // 充当客户端的请求json串
    std::string in_json;
    Json::Value in_value;
    // R"()" -> raw string，将字符串中的字符保持原貌
    in_value["code"] = R"(#include <iostream>
    int main(){
        aaaa
        std::cout << "这是一段测试代码" << std::endl;
        return 0;
    })";
    in_value["input"] = "";
    in_value["cpu_limit"] = 1;
    in_value["mem_limit"] = 30 * 1024; // 30MB，该单位是KB

    Json::StyledWriter writer;
    in_json = writer.write(in_value);

    std::cout << in_json << std::endl;

    std::string out_json;
    CompileAndRun::Start(in_json, &out_json);

    std::cout << out_json << std::endl;

    return 0;
}